package com.ionehe.group.common.file.ex.utils;

import java.util.Objects;

/**
 * 文件类型枚举
 * @author 2022/1/14 <a href="mailto:a@ionehe.com">xiu</a>
 */
public enum FileType {
    RAR("RAR", 0, 1, "压缩包"),
    ZIP("ZIP", 1, 2, "zip压缩包"),
    PDF("PDF", 2, 3, "pdf文档"),
    IOS("IOS", 3, 4, "镜像文件"),
    HTML("HTML", 4, 5, "网页"),
    RM("RM", 5, 6, "视频文件"),
    XLS("XLS", 6, 7, "excel文件"),
    DOC("DOC", 7, 8, "word文件"),
    TXT("TXT", 8, 9, "记事本"),
    IMAGE("IMAGE", 9, 10, "图片"),
    OTHER("OTHER", 10, 11, "其它");

    private final int value;
    private final String description;
    private static final FileType[] $VALUES = new FileType[]{RAR, ZIP, PDF, IOS, HTML, RM, XLS, DOC, TXT, IMAGE, OTHER};

    private FileType(String var1, int var2, int value, String description) {
        this.value = value;
        this.description = description;
    }

    public static FileType from(Integer value) {
        FileType[] var1 = values();
        int var2 = var1.length;

        for (int var3 = 0; var3 < var2; ++var3) {
            FileType t = var1[var3];
            if (Objects.equals(t.value, value)) {
                return t;
            }
        }

        return null;
    }

    public int value() {
        return this.value;
    }

    @Override
    public String toString() {
        return this.description;
    }
}
